package cn.com.sbell.vss.csg.vap;

import org.dom4j.Element;

import cn.com.sbell.vss.VssConstants;
import cn.com.sbell.vss.VssException;
import cn.com.sbell.vss.csg.vap.bean.VSCommon;
import cn.com.sbell.vss.csg.vsclient.VsClient;
import cn.com.sbell.vss.csg.vsclient.util.BeanValidator;
import cn.com.sbell.vss.csg.vsclient.util.PropertiesHolder;

public class SetVsCommonInfo extends ProtectedVsCommander {

	protected Element executeCommand(VsClient vsClient,
			PropertiesHolder holder, Element root) {
		VSCommon commonInfo = (VSCommon) holder.populate(new VSCommon());
		BeanValidator.validateNotNull(commonInfo, new String[] { "deviceId" });
		if(!vsClient.setVSCommon(commonInfo)){
			throw new VssException(VssConstants.CODE_SET_VS_COMMON_FAILED);	
		}
		return root;
	}

}
